<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="css/style.css" />
		<link rel="stylesheet" type="text/css" href="css/iconfont.css" />
		<link href="css/mui.picker.css" rel="stylesheet" />
		<link href="css/mui.poppicker.css" rel="stylesheet" />
		<style type="text/css">
			.mui-btn-block {
				font-weight: bold;
			}
			
			.title {
				padding: 15px;
				color: #11cd6e;
			}
			
			.title div {
				display: table-cell;
				height: 30px;
				vertical-align: middle;
			}
			
			.title span {
				font-size: 24px;
			}
			
			.amount {
				background-color: #fff;
				padding: 20px;
				text-align: center;
				border-bottom: solid 1px #eee;
			}
			
			.amount h1 {
				font-size: 40px;
				font-weight: normal;
				vertical-align: top;
			}
			
			.amount h1 span {
				font-size: 20px;
				vertical-align: top;
			}
			
			.list {
				background-color: #fff;
				padding: 10px;
			}
			
			.list table {
				width: 100%;
				color: #999;
			}
			
			.list td,
			.list th {
				padding: 4px;
			}
			
			.list th {
				text-align: left;
				font-weight: normal;
			}
			
			.list td {
				text-align: right;
			}
			
			.success {
				font-size: 25px;
				line-height: 1.5em;
			}
			
			.success .iconfont {
				font-size: 30px;
				line-height: 1.5em;
			}
			
			.icon-waitpay,.icon-waitpay~span{color: #007AFF;}
			.icon-error,.icon-error~span{color: #F14E11;}
			.icon-success1,.icon-success1~span{color: #11CD6E;}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<h1 class="mui-title">支付结果</h1>
		</header>
		<div class="mui-content">
			<div class="mui-content-padded success">
				<span class="mui-icon iconfont" :class="resources.GetPayRecordsStatusClassByValue(model.Status)"></span> <span v-text="resources.GetPayRecordsStatusTextByValue(model.Status)"></span>
			</div>
			<div class="mui-content">
				<div>
					<div class="amount">
						<div class="mui-h3 pt-5">￥<span class="mui-h1" v-text="model.Amount.toFixed(2)">0.00</span></div>
						<div class="mui-h6 pt-5" v-text="model.TradeName"></div>
					</div>
					<div class="list">
						<table>
							<tr>
								<th>交易时间</th>
								<td id="AssetType" v-text="model.TradeTime"></td>
							</tr>
							<tr>
								<th>交易单号</th>
								<td id="AssetType" v-text="model.TradeNo"></td>
							</tr>
							<tr>
								<th>支付方式</th>
								<td id="ChangeAfterBalance" v-text="resources.GetPayTypeTextByValue(model.PayType)"></td>
							</tr>
						</table>
					</div>
				</div>
			</div>
			<div class="mui-content-padded pt-10">
				<button type="button" id="submit" class="mui-btn mui-btn-blue mui-btn-block" @tap="done">完成</button>
			</div>
		</div>
		<script src="js/mui.min.js"></script>
		<script src="js/vue.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/app.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/resources.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			mui.init();
			
			var tradeType;
			
			done = function () {
				
//				var wvs = plus.webview.all(); //所有窗口对象
//				var launch = plus.webview.getLaunchWebview(); //首页窗口对象
//				var self = plus.webview.currentWebview(); //当前窗口对象
//				for(var i = 0, len = wvs.length; i < len; i++) {
//					console.log(wvs[i].id);
//					
//				    // 首页以及当前窗口对象，不关闭；
//				    if(wvs[i].id === launch.id || wvs[i].id === self.id) {
//				        //continue;
//				    } else {
//				        //wvs[i].close('none'); //关闭中间的窗口对象，为防止闪屏，不使用动画效果；
//				    }
//				}
				// 此时，窗口对象只剩下首页以及当前窗口，直接关闭当前窗口即可；
				//self.close('slide-out-right');
				
				var wv;
				if(tradeType == resources.PayTradeType.Repay){
					wv = plus.webview.getWebviewById("ccard.html");
					wv.evalJS("refresh()");
					plus.webview.getWebviewById("ccard-plan.html").close("none");
					plus.webview.getWebviewById("ccard-plan-preview.html").close("none");
				}
				else if(tradeType == resources.PayTradeType.Recharge){
					wv = plus.webview.getWebviewById("account-in.html");
					wv.evalJS("init()");
				} 
				
				plus.webview.getWebviewById("checkout.html").close("none");
				plus.webview.currentWebview().close();
			};
			
			init = function() {
				var wv = plus.webview.currentWebview();
				var data = wv.data;
				tradeType = wv.TradeType;
				console.log(tradeType);
								
				var vm = new Vue({
					el: '.mui-content',
					data: {
						'model': data
					},
					created: function() { 
					},
					computed: {},
					methods: {}
				});
			};

			mui.plusReady(function() {
				init();

			});
		</script>
	</body>

</html>